From: Christian Aistleitner Date: Mon, 19 Mar 2012 11:14:43 +0000 (+0000) Subject: Sanitizing already existing use of PHP's assert X-Git-Tag: 1.31.0-rc.0~24206 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=0954fc366fd2e7fe968589acfc8d3592f9b04221;p=lhc%2Fweb%2Fwiklou.git Sanitizing already existing use of PHP's assert --- diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php index e7c439313b..72eb5d3c2c 100644 --- a/includes/diff/DairikiDiff.php +++ b/includes/diff/DairikiDiff.php @@ -185,8 +185,8 @@ class _DiffEngine { $edits = array(); $xi = $yi = 0; while ( $xi < $n_from || $yi < $n_to ) { - assert( $yi < $n_to || $this->xchanged[$xi] ); - assert( $xi < $n_from || $this->ychanged[$yi] ); + assert( '$yi < $n_to || $this->xchanged[$xi]' ); + assert( '$xi < $n_from || $this->ychanged[$yi]' ); // Skip matching "snake". $copy = array(); @@ -374,14 +374,14 @@ class _DiffEngine { while ( list( , $y ) = each( $matches ) ) { if ( empty( $this->in_seq[$y] ) ) { $k = $this->_lcs_pos( $y ); - assert( $k > 0 ); + assert( '$k > 0' ); $ymids[$k] = $ymids[$k -1]; break; } } while ( list ( , $y ) = each( $matches ) ) { if ( $y > $this->seq[$k -1] ) { - assert( $y < $this->seq[$k] ); + assert( '$y < $this->seq[$k]' ); // Optimization: this is a common case: // next match is just replacing previous match. $this->in_seq[$this->seq[$k]] = false; @@ -389,7 +389,7 @@ class _DiffEngine { $this->in_seq[$y] = 1; } elseif ( empty( $this->in_seq[$y] ) ) { $k = $this->_lcs_pos( $y ); - assert( $k > 0 ); + assert( '$k > 0' ); $ymids[$k] = $ymids[$k -1]; } } @@ -430,7 +430,7 @@ class _DiffEngine { } } - assert( $ypos != $this->seq[$end] ); + assert( '$ypos != $this->seq[$end]' ); $this->in_seq[$this->seq[$end]] = false; $this->seq[$end] = $ypos; @@ -814,8 +814,8 @@ class MappedDiff extends Diff { $mapped_from_lines, $mapped_to_lines ) { wfProfileIn( __METHOD__ ); - assert( sizeof( $from_lines ) == sizeof( $mapped_from_lines ) ); - assert( sizeof( $to_lines ) == sizeof( $mapped_to_lines ) ); + assert( 'sizeof( $from_lines ) == sizeof( $mapped_from_lines )' ); + assert( 'sizeof( $to_lines ) == sizeof( $mapped_to_lines )' ); parent::__construct( $mapped_from_lines, $mapped_to_lines ); @@ -1205,7 +1205,7 @@ class _HWLDF_WordAccumulator { $this->_flushLine( $tag ); $word = substr( $word, 1 ); } - assert( !strstr( $word, "\n" ) ); + assert( '!strstr( $word, "\n" )' ); $this->_group .= $word; } } diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 54079acfe4..f129f73df8 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -479,7 +479,7 @@ class Preprocessor_DOM implements Preprocessor { } elseif ( $found == 'line-end' ) { $piece = $stack->top; // A heading must be open, otherwise \n wouldn't have been in the search list - assert( $piece->open == "\n" ); + assert( '$piece->open == "\n"' ); $part = $piece->getCurrentPart(); // Search back through the input to see if it has a proper close // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 9453b90f4f..28283c74b2 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -428,7 +428,7 @@ class Preprocessor_Hash implements Preprocessor { } elseif ( $found == 'line-end' ) { $piece = $stack->top; // A heading must be open, otherwise \n wouldn't have been in the search list - assert( $piece->open == "\n" ); + assert( '$piece->open == "\n"' ); $part = $piece->getCurrentPart(); // Search back through the input to see if it has a proper close // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient diff --git a/includes/parser/Preprocessor_HipHop.hphp b/includes/parser/Preprocessor_HipHop.hphp index f5af015454..0cf2e8a0a7 100644 --- a/includes/parser/Preprocessor_HipHop.hphp +++ b/includes/parser/Preprocessor_HipHop.hphp @@ -444,7 +444,7 @@ class Preprocessor_HipHop implements Preprocessor { } elseif ( $found === 'line-end' ) { $piece = $stack->getTop(); // A heading must be open, otherwise \n wouldn't have been in the search list - assert( $piece->open === "\n" ); + assert( '$piece->open === "\n"' ); $part = $piece->getCurrentPart(); // Search back through the input to see if it has a proper close // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient